﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DTO;
using BUS;

namespace GaSaiGon.GUI
{
    public partial class frmThemSuaTaiKhoan : Form
    {
        string _status;

        public string Status
        {
            get { return _status; }
            set { _status = value; }
        }
        public frmThemSuaTaiKhoan()
        {
            InitializeComponent();
        }
        private void btnThem_Click(object sender, EventArgs e)
        {
            TaiKhoanDTO TKDTO = new TaiKhoanDTO(txtTenDangNhap.Text,txtMatKhau.Text,txtHoTen.Text,txtCMND.Text,Convert.ToDateTime(dateTimePicker.Text),Convert.ToInt32(cbxGioiTinh.Text),txtDiaChi.Text,txtDienThoai.Text,Convert.ToInt32(cbxChucVu.Text));
            TaiKhoanBUS TKBUS = new TaiKhoanBUS();
            TKBUS.ThemTaiKhoan(TKDTO);
            this.Close();
        }
        private void btnThoat_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void frmThemSuaTaiKhoan_Load(object sender, EventArgs e)
        {
            TaiKhoanBUS TKBUS = new TaiKhoanBUS();
            cbxChucVu.DataSource = TKBUS.DanhSachChucVu();
            cbxChucVu.DisplayMember = "LoaiChucVu";
            cbxChucVu.ValueMember = "MaChucVu";

            cbxGioiTinh.DataSource = TKBUS.DanhSachGioiTinh();
            cbxGioiTinh.DisplayMember = "LoaiGioiTinh";
            cbxGioiTinh.ValueMember = "MaGioiTinh";
        }     
    }
}
